From: vhanquez@kneesa.uk.xensource.com Date: Fri, 28 Apr 2006 15:44:00 +0000 (+0100) Subject: Wait for the device to be connected on the guest (with a 10s timeout) X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16108^2~49 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=4fabe234e8d2895bd2f49d43263f3dafb4658695;p=xen.git Wait for the device to be connected on the guest (with a 10s timeout) before detaching it. Fix a race condition that dom0 was tearing down the block device while the guest was putting it in a Connected state. Signed-off-by: Vincent Hanquez --- diff --git a/tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py b/tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py index 01e81122b2..25bba2183c 100644 --- a/tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py +++ b/tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py @@ -26,6 +26,12 @@ def checkXmLongList(domain): else: return False +def checkBlockState(domain): + s, o = traceCommand("xm block-list %s | awk '{print $4}' |tail -n 1" % domain.getName()) + if s != 0: + FAIL("block-list failed") + return int(o) + if ENABLE_HVM_SUPPORT: SKIP("Block-detach not supported for HVM domains") @@ -46,7 +52,11 @@ if not checkBlockList(domain): if not checkXmLongList(domain): FAIL("xm long list does not show that hda1 was attached") -time.sleep(2) +for i in range(1, 10): + time.sleep(1) + state = checkBlockState(domain) + if state == 4: + break s, o = traceCommand("xm block-detach %s hda1" % domain.getName()) if s != 0: